package cn;

import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/***
 *  不同工作类型职工的接口
 *
 * */
public interface  WorkType {

    public   BigDecimal calc();

    final SimpleDateFormat sd = new SimpleDateFormat("MM-dd");


    default boolean checkToday(String birthDay){
        if(StringUtils.isBlank(birthDay)){
            return  false;
        }
        String eL = "[0-9]{4}-[0-9]{2}-[0-9]{2}";
        Pattern  p = Pattern.compile(eL);
        Matcher m = p.matcher(birthDay);
        boolean dateFlag = m.matches();
        if (!dateFlag) {
            System.out.println("请修正员工生日格式为：yyyy-mm-dd");
            return false;
        }
        String monthDay = sd.format(new Date()).toString();
        birthDay = birthDay.substring(birthDay.indexOf("-")+1, birthDay.length());
        return  monthDay.equals(birthDay);
    }
}
